package com.example.aboutspringboot.service;

import com.example.aboutspringboot.entity.Order;
import com.example.aboutspringboot.entity.OrderItem;
import com.example.aboutspringboot.mapper.OrderMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class OrderService {
    @Resource
    private OrderMapper orderMapper;

    public List<Order> selectOrderAll() {
        return orderMapper.selectOrderAll();
    }

    public List<OrderItem> selectOrderItem(long id) {
        return orderMapper.selectOrderItem(id);
    }

    //创建订单
    public int insertOrder(Order order){
        return orderMapper.insertOrder(order);
    }

    public int insertOrderItem(OrderItem orderItem){
        return orderMapper.insertOrderItem(orderItem);
    }
    public int selectOrderItemId(String username,String date){
        return orderMapper.selectOrderItemId(username, date);
    }
}
